#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>

#define FOR(i,a,n) for(int i=a,_n(n);i<_n;++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

typedef long long lld;

vector<lld> luckyNum;

void Dfs(lld n,int dep)
{
    if(dep>10) return;
    luckyNum.push_back(n);
    Dfs(n*10+4,dep+1);
    Dfs(n*10+7,dep+1);
}

void Init()
{
    Dfs(4,1);
    Dfs(7,1);
    sort(luckyNum.begin(),luckyNum.end());
}

int GetPos(int k)
{
    REP(i,luckyNum.size()) if(luckyNum[i]>=k)
        return i;
}

lld GetAns(int l,int r)
{
    int lb = GetPos(l);
    int rb = GetPos(r);
    //printf("lc[%d]=%d lc[%d]=%d\n",lb,luckyNum[lb],rb,luckyNum[rb]);
    if(lb==rb) return 1LL*(r-l+1)*luckyNum[lb];
    else
    {
        lld ret = 1LL*(luckyNum[lb]-l+1)*luckyNum[lb];
        ret += 1LL*(r-luckyNum[rb-1])*luckyNum[rb];
        FOR(i,lb,rb-1)
        {
            ret += 1LL*(luckyNum[i+1]-luckyNum[i])*luckyNum[i+1];
        }
        return ret;
    }
}

int main()
{
    Init();
    int l,r;
    while(cin>>l>>r)
    {
        cout<<GetAns(l,r)<<endl;
    }
	return 0;
}
